package org.anyin.gitee.cloud.center.upms.api;

import org.anyin.gitee.cloud.center.common.feign.FeignConfig;
import org.anyin.gitee.cloud.center.upms.api.resp.SysUserPermissionResp;
import org.anyin.gitee.cloud.center.upms.api.resp.SysUserResp;
import org.anyin.gitee.cloud.lib.core.web.ApiResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "anyin-center-upms",
        contextId = "SysUserFeignApi",
        configuration = FeignConfig.class,
        path = "/api/sys-user")
public interface SysUserFeignApi {
    /**
     * 查询用户
     * @param username 用户名
     */
    @GetMapping("/info/username")
    ApiResponse<SysUserResp> infoByUsername(@RequestParam("username") String username);

    /**
     * 查询用户
     * @param mobile 手机号
     */
    @GetMapping("/info/mobile")
    ApiResponse<SysUserResp> infoByMobile(@RequestParam("mobile") String mobile);

    /**
     * 查询用户
     * @param email 邮箱
     */
    @GetMapping("/info/email")
    ApiResponse<SysUserResp> infoByEmail(@RequestParam("email") String email);

    /**
     * 查询权限
     * @param id 用户ID
     */
    @GetMapping("/permission/id")
    ApiResponse<SysUserPermissionResp> permissionById(@RequestParam("id") Long id);
}
